{{ define "admin/goodsTypeAttribute/edit.html" }}
    {{ template "admin/common/page_header.html" .}}


    <div class="container-fluid p-t-15">
        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-body">
                        <form action="/admin/goodsTypeAttribute/doEdit" method="post">
                            <input type="hidden" name="id" value="{{.goodsTypeAttribute.Id}}" />
                            <div class="form-group col-md-12">
                                <label for="title">属性名称</label>
                                <input type="text" class="form-control" id="title" name="title" value="{{.goodsTypeAttribute.Title}}"  placeholder="请输入属性名称">
                            </div>

                            <div class="form-group col-md-12">
                                <label for="type">所属类型</label>
                                <div class="form-controls">
                                    {{$cateId := .goodsTypeAttribute.CateId}}
                                    <select name="cate_id" id="cate_id" class="form-control">
                                        {{range $key,$value := .goodsTypeList}}
                                            <option {{if eq $cateId $value.Id}} selected {{end}}  value="{{$value.Id}}">{{$value.Title}}</option>
                                        {{end}}
                                    </select>
                                </div>
                            </div>

                            <div class="form-group col-md-12">
                                <label for="status">录入方式</label>
                                <div class="clearfix">
                                    <div class="custom-control custom-radio custom-control-inline">
                                        <input type="radio" id="statusOne" name="attr_type" class="custom-control-input"  {{if eq .goodsTypeAttribute.AttrType 1}} checked="true" {{end}} value="1">
                                        <label class="custom-control-label" for="statusOne">单行文本框</label>
                                    </div>
                                    <div class="custom-control custom-radio custom-control-inline">
                                        <input type="radio" id="statusTwo" name="attr_type" class="custom-control-input" {{if eq .goodsTypeAttribute.AttrType 2}} checked="true" {{end}} value="2">
                                        <label class="custom-control-label" for="statusTwo">多行文本框</label>
                                    </div>
                                    <div class="custom-control custom-radio custom-control-inline">
                                        <input type="radio" id="statusThree" name="attr_type" class="custom-control-input" {{if eq .goodsTypeAttribute.AttrType 3}} checked="true" {{end}} value="3">
                                        <label class="custom-control-label" for="statusThree">从下面的列表中选择（一行代表一个可选值）</label>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group col-md-12">
                                <label for="attr_value">可选值列表</label>
                                <textarea  class="form-control" id="attr_value" name="attr_value" value="{{.goodsTypeAttribute.AttrValue}}" rows="8"  {{if ne .goodsTypeAttribute.AttrType 3}} disabled="disabled" {{end}} placeholder="可选值列表">
                                    {{.goodsTypeAttribute.AttrValue}}
                                </textarea>
                            </div>

                            <div class="form-group col-md-12">
                                <label for="sort">排　　序</label>
                                <input type="text" id="sort" name="sort" class="form-control" value="{{.goodsTypeAttribute.Sort}}" >
                            </div>
                            <div class="form-group col-md-12">
                                <button type="submit" class="btn btn-primary ajax-post" target-form="add-form">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script>

$(function(){    
        $("input[name='attr_type").change(function(){
            // alert($(this).val())
            if($(this).val()==3){
                $("#attr_value").attr("disabled",false)
            }else{
                $("#attr_value").attr("disabled",true)
            }
        })
})
</script>

{{end}}